/**
 * 
 */
package com.mycompany.client;

import com.mycompany.client.dataset.SideNavGridDS;
import com.mycompany.shared.EnvConstants;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.GroupStartOpen;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;

/**
 * @author coral.ma
 * 
 */
public class SideNavGrid extends ListGrid {

	public SideNavGrid() {
		SideNavGridDS dataSource = SideNavGridDS.getInstance();
		this.setCanEdit(false);
		this.setCanFreezeFields(false);
		this.setWidth100();
		this.setHeight100();
		this.setShowAllRecords(true);
		this.setGroupByField("category");
		this.setGroupStartOpen(GroupStartOpen.ALL);
		this.setDataSource(dataSource);

		ListGridField nodeField = new ListGridField("node");
		nodeField.setWidth(EnvConstants.SIDE_NAVIGATION_BAR_LENGTH - 2);
		nodeField.setCanSort(false);
		nodeField.setAlign(Alignment.CENTER);
		ListGridField categoryField = new ListGridField("category");
		categoryField.setHidden(true);
		ListGridField pageField = new ListGridField("page");
		pageField.setHidden(true);
		this.setFields(nodeField, categoryField, pageField);
		this.setAutoFetchData(true);
	}
}
